package cn.zc.examination.service.controller;


import cn.tools.core.VO.PageVO;
import cn.tools.core.base.R;
import cn.zc.examination.entity.Dto.ExaminationBankDto;
import cn.zc.examination.entity.VO.ExaminationBankVO;
import cn.zc.examination.service.service.ExaminationBankService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 考试题库 前端控制器
 * </p>
 *
 * @author keno
 * @since 2022-02-22
 */
@Api(tags = "后台考题题接口")
@RestController
@RequestMapping("/examination")
public class ExaminationBankController {

    @Resource
    private ExaminationBankService examinationBankService;


    /**
     * 创建考题接口
     * @param examinationBankDto
     * @return
     */
    @ApiOperation(value = "创建考题接口")
    @PostMapping("/admin/create/ExaminationBank")
    private R createExaminationBank(@RequestBody ExaminationBankDto examinationBankDto){
        examinationBankService.createExaminationBank(examinationBankDto);
        return R.success();
    }

    /**
     * 修改考题接口
     * @param examinationBankDto
     * @return
     */
    @ApiOperation(value = "修改考题接口")
    @PutMapping("/admin/update/ExaminationBank")
    private R updateExaminationBank(@RequestBody ExaminationBankDto examinationBankDto){
        examinationBankService.updateExaminationBank(examinationBankDto);
        return R.success();
    }

    /**
     * 删除考题接口
     * @param id
     * @return
     */
    @ApiOperation(value = "删除考题接口")
    @PostMapping("/admin/delete/ExaminationBank")
    private R deleteExaminationBank(String id){
        examinationBankService.deleteExaminationBank(id);
        return R.success();
    }


    /**
     * 查询考题接口
     * @param pageVO
     * @param examinationBankVO
     * @return
     */
    @ApiOperation(value = "查询考题接口")
    @GetMapping("/admin/find/ExaminationBank")
    private R<Object> findExaminationBank(PageVO pageVO, ExaminationBankVO examinationBankVO){
        List<ExaminationBankDto> examinationBankBankDto = examinationBankService.findExaminationBank(pageVO,examinationBankVO);
        return R.success(examinationBankBankDto);
    }



}

